use std::collections::HashMap;
pub fn my_number() {
    let mut vec = vec![3, 2, 3, 7, 85, 12, 45, 65, 15, 45, 25, 99];
    let mut sum = 0;
    for i in &vec {
        sum += i;
    }

    let len: usize = vec.len();
    for i in 0..len {
        for j in i..(len - 1) {
            if vec[i] > vec[j + 1] {
                let tem = vec[i];
                vec[i] = vec[j + 1];
                vec[j + 1] = tem;
            }
        }
    }
    println!("{}", len % 2);
    let avg: f64 = (((sum as f64) / (len as f64)) * 100.0).round() / 100.0;
    let mid: f64 = match len % 2 {
        0 => ((((vec[len / 2] + vec[len / 2 - 1]) / 2) as f64) * 100.0).round() / 100.0,
        1 => (((vec[len / 2]) as f64) * 100.0).round() / 100.0,
        _ => panic!("error"),
    };
    let mut map = HashMap::new();
    for i in &vec {
        let val = map.entry(i).or_insert(0);
        *val += 1
    }
    let mut res = vec![];
    let mut mx = 0;
    for (_key, &val) in &map {
        if mx < val {
            mx = val;
        }
    }
    for (key, &val) in &map {
        if mx == val {
            res.push(key)
        }
    }
    println!(
        "vec: {:?},sum{:?},avg{:.2},len{},mid{:.2},\nmap:{:#?},\nres:{:?}",
        vec, sum, avg, len, mid, map, res
    );
}
